class_name Enemy
extends RefCounted

var name: String
var health: int
var max_health: int
var damage: int
var block: int
var is_elite: bool = false
var is_boss: bool = false
var floor_level: int = 1

# 考试主题的怪物
var exam_type: String  # 如"数学考试"、"语文考试"等

func _init(enemy_name: String, enemy_health: int, enemy_damage: int, exam: String, floor_num: int = 1):
	name = enemy_name
	health = enemy_health
	max_health = enemy_health
	damage = enemy_damage
	block = 0
	exam_type = exam
	floor_level = floor_num

func take_damage(amount: int) -> void:
	var actual_damage = max(0, amount - block)
	health -= actual_damage
	block = max(0, block - amount)
	
	if health <= 0:
		on_death()

func add_block(amount: int) -> void:
	block += amount

func on_death() -> void:
	# 死亡时的效果
	pass

func get_action() -> String:
	# 返回敌人这回合的行动
	return "攻击"

func execute_action() -> void:
	# 执行敌人行动
	var game_data = GameData.get_instance()
	game_data.player_health -= damage

func is_alive() -> bool:
	return health > 0
